﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FontManager
{
    /// <summary>
    /// dummy set is the class representing dummy which is used in datagridview to see what characters are expected
    /// </summary>
    public class DummySet
    {
        /// <summary>
        /// _name of dummy set
        /// </summary>
        public string Name = "";
        /// <summary>
        /// list of characters in dummyset
        /// </summary>
        public string Characters = "";
        /// <summary>
        /// the number of characters
        /// </summary>
        public int Count = 0;
        /// <summary>
        /// List of all characters character values.
        /// This list is what is used in drawing the set;
        /// </summary>
        public List<string> HexsValueList = new List<string>();

        /// <summary>
        /// empty constructor with no guessed values
        /// </summary>
        public DummySet()
        { }

        /// <summary>
        /// initializes dummy from known values, used in loading from XML process.
        /// </summary>
        /// <param _name="_name">the _name of this dummy set</param>
        /// <param _name="characters">string of characters which will be used</param>
        public DummySet(string name, string characters)
        {
            this.Name = name;
            this.Characters = characters;

            foreach(char i in Characters)
            {
                char c = i;
                int unicode = c;
                string hex = string.Format("0x{0:x4}", unicode);
                if(!HexsValueList.Contains(hex))
                    HexsValueList.Add(hex);
            }

            this.Count = HexsValueList.Count;
            Helper.sortListByHex(HexsValueList);
        }
    }
}
